const { Article } = require('../../model/article');
const pagination = require('mongoose-sex-page');
module.exports = async (req, res) => {
    // 标识 标识当前访问的是文章管理页面
    req.app.locals.currentLink = 'article';
    const page = req.query.page;
    let articles = await pagination(Article).find().page(page).size(2).display(3).populate('author').exec();
    let str = JSON.stringify(articles);
    let json = JSON.parse(str);
    // res.send(articles)
    // 渲染文章列表页面模板
    res.render('admin/article.art', {
        articles: json
    });
}